package com.cdd.framework.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cdd.framework.web.domain.SysOperLog;
import com.cdd.framework.web.mapper.SysOperLogMapper;
import com.cdd.framework.web.service.ISysOperLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * 操作日志 服务层处理
 *
 * @author lc
 */
@Service
public class SysOperLogServiceImpl implements ISysOperLogService
{
    @Resource
    private SysOperLogMapper operLogMapper;

    /**
     * 新增操作日志
     */
    @Override
    public void insertOperlog(SysOperLog operLog)
    {
        operLogMapper.insert(operLog);
    }

    /**
     * 查询系统操作日志集合
     */
    @Override
    public List<SysOperLog> selectOperLogList(SysOperLog operLog)
    {
        return operLogMapper.selectList(new LambdaQueryWrapper<>());
    }

    /**
     * 批量删除系统操作日志
     */
    @Override
    public int deleteOperLogByIds(Long[] operIds)
    {
        return operLogMapper.deleteBatchIds(Arrays.asList(operIds));
    }

    /**
     * 查询操作日志详细
     */
    @Override
    public SysOperLog selectOperLogById(Long operId)
    {
        return operLogMapper.selectById(operId);
    }

    /**
     * 清空操作日志
     */
    @Override
    public void cleanOperLog()
    {
        operLogMapper.clear();
    }
}
